package com.productssite.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Productcategory entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "productcategory", catalog = "productssalessite")
public class ProductCategory implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer idProductCategory;
	private String categoryName;
	private Set<Product> products = new HashSet<Product>(0);

	// Constructors

	/** default constructor */
	public ProductCategory() {
	}

	/** minimal constructor */
	public ProductCategory(Integer idProductCategory) {
		this.idProductCategory = idProductCategory;
	}

	/** full constructor */
	public ProductCategory(Integer idProductCategory, String categoryName,
			Set<Product> products) {
		this.idProductCategory = idProductCategory;
		this.categoryName = categoryName;
		this.products = products;
	}

	// Property accessors
	@Id
	@Column(name = "idProductCategory", unique = true, nullable = false)
	public Integer getIdProductCategory() {
		return this.idProductCategory;
	}

	public void setIdProductCategory(Integer idProductCategory) {
		this.idProductCategory = idProductCategory;
	}

	@Column(name = "categoryName", length = 254)
	public String getCategoryName() {
		return this.categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "productcategory")
	public Set<Product> getProducts() {
		return this.products;
	}

	public void setProducts(Set<Product> products) {
		this.products = products;
	}

}